<?php namespace Home\Model;
use Hdphp\Model\Model;
class OrderList extends Model{
//  指定表名
    protected $table = "order_list";
//  添加
    public function store($oid){
    	$keys = Q("post.key");
		$data= $_SESSION['cart'];
		
		$OrderData= [];
		foreach ($data['goods'] as $key => $value) {
			foreach ($keys as $k => $v) {
				if($v == $key){
					$OrderData[$key]=$value;
				}
			}
		}

//		p($OrderData);
		foreach ($OrderData as $k => $v) {
			$Data = [
				'quantity'=>$v['num'],
				'subtotal'=>$v['total'],
				'explain'=>$v['options']['combine'],
				'glnumber'=>$v['options']['number'],
				'orders_oid'=>$oid,
				'goods_aid'=>$v['id'],
				'goods_list_glid'=>$v['options']['glid']['glid']
			];
       		$this->add($Data);
		}
    }
}